<% layout('/layouts/default.html', {title: '任务部署分发表管理', libs: ['dataGrid']}){ %>
<div class="main-content">
  <div class="box box-main">
    <div class="box-header">
      <#form:form id="searchForm" model="${dcSupTaskAction}" action="${ctx}/action/dcSupTaskAction/listData" method="post" class="form-inline"
      data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
      <div style="float: right">
        <div class="form-group">
          <label class="control-label">${text('任务年度')}：</label>
          <div class="control-inline width-120" style="width: 150px" >
            <#form:select path="taskYear" items="${yearList}" blankOption="true" data-placeholder="请选择" itemLabel="yearLabel" itemValue="yearValue" class="form-control width-120"/>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label">${text('任务内容')}：</label>
          <div class="control-inline width-160">
            <#form:input path="taskContent" placeholder="请输入任务内容" maxlength="200" class="form-control width-160"/>
            <#form:hidden path="taskId" />
            <#form:hidden path="taskProgress" />
            <#form:hidden path="taskLeader" />
            <#form:hidden path="taskTitle" />
            <#form:hidden path="searchType"/>
            <#form:hidden path="timeParam" value="${dcSupTaskAction.timeParam!}" />
          </div>
        </div>
        <div class="form-group">
          <button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
          <button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
        </div>
      </div>
    </#form:form>
  </div>
    <div class="box-body">
      <table id="dataGrid"></table>
      <div id="dataGridPage"></div>
    </div>
  </div>
</div>
<% } %>
<script>
  //重置
  function cz(){
    searchForm.reset();
    $('#dataGrid').dataGrid('reloadGrid');
  }

  // 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
    sortableColumn: false, // 列表不允许排序
	columnModel: [
      {header:'${text("任务标题")}', name:'taskTitle', index:'b.task_title', width:150, align:"left"

      },
      {header:'${text("任务类型")}', name:'taskTypeName', index:'b.task_type_code', width:150, align:"left"},

      {header:'${text("任务内容")}', name:'taskContent', index:'b.task_content', width:150, align:"left"},
      {header:'${text("牵头领导")}', name:'taskLeaderName', index:'b.task_leader_name', width:150, align:"left"},
		{header:'${text("牵头责任单位")}', name:'leaderOrgName', index:'a.leader_org_name', width:150, align:"left"},
      {header:'${text("任务完成进度")}', name:'taskProgress', index:'a.task_progress', width:150, align:"center"
        ,formatter: function(val, obj, row, act){

          return js.getDictLabel(${@DictUtils.getDictListJson('dc_task_progress')}, val, '${text("未知")}', true);
        }},
		{header:'${text("任务状态")}', name:'taskStatus', index:'a.task_status', width:150, align:"center"
          ,formatter: function(val, obj, row, act){

            return js.getDictLabel(${@DictUtils.getDictListJson('dc_task_action_status')}, val, '${text("未知")}', true);
          }},
		{header:'${text("操作")}', name:'actions', width:250, align:"center",formatter: function(val, obj, row, act){
			var actions = [];

			/*	actions.push('<a href="${ctx}/action/dcSupTaskAction/form?id='+row.id+'" class="btn btn-primary btn-xs" title="${text("查看")}">查看</a>&nbsp;');*/

              actions.push('<a  href="${ctx}/audit/taskReceive/taskReceiveFive?remarks2=0&isNewRecord=false&id=' + row.id + '&taskId=' + row.taskId + '" class="btn btn-primary btn-xs btnList" title="${text("反馈记录")}"><span>反馈记录</span></a>&nbsp;');
              actions.push('<a href="javascript:void(0);" onclick="showRecord(\''+row.taskId+'\');" class="btn btn-primary btn-xs" title="${text("审核记录")}">审核记录</a>&nbsp;');
              actions.push('<a style="cursor:pointer;" onclick=addFeedback("' + row.id + '") class="btn btn-primary btn-xs" title="${text("增加反馈")}" ><span>增加反馈</span></a>&nbsp;');
              if('${dcSupTaskAction.remarks1}'==1){
                actions.push('<a style="cursor:pointer;" onclick=cuiban("' + row.id + '") class="btn btn-primary btn-xs" title="${text("催办")}" ><span>催办</span></a>&nbsp;');
              }

            return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});


  // 审核记录
  function showRecord(targetId) {
    js.layer.open({
      type:2,
      title:'',
      area:['1200px','600px'],
      scrollbar: true,
      shadeClose: false,
      content:"${ctx}/audit/dcSupTaskAudit/record?targetId="+targetId,
      btn:[],
      btn1:function (index,layero) {

      }
    });
  }
  function fanhui(pageNo,pageSize) {
    window.location.href='${ctx}/taskdeploy/dcSupTaskInfo/listed?remarks3=${dcSupTaskAction.remarks3}&remarks4=${dcSupTaskAction.remarks4}'
  }

  function cuiban(id){
    js.loading();
    js.layer.open({
      type: 2,
      title: ['催办'],
      area: ['800px', '400px'],
      scrollbar: true,
      shadeClose: false,
      content: "${ctx}/home/supIndex/cuibanPage?id="+id,
      btn1: function (index, layero) {
      },
      success: function (data) {
        js.closeLoading(0, true);
      },
      end:function () {

      }
    });

    // js.loading("正在催办...");
    // $.ajax({
    //   url: "${ctx}/home/supIndex/cuiban",
    //   type: "post",
    //   data: {
    //     "id":id
    //   },
    //   success: function(data){
    //     js.closeLoading(0, true);
    //     js.showMessage(data.message);
    //   },
    //   error: function(data){
    //     js.closeLoading(0, true);
    //     js.showErrorMessage(data.responseJSON.message+"，请联系管理员");
    //   }
    // });
  }

  function addFeedback(id) {
    js.loading();
    js.layer.open({
      type: 2,
      title: ['增加反馈'],
      area: ['800px', '410px'],
      scrollbar: true,
      shadeClose: false,
      content: "${ctx}/feedback/dcSupTaskFeedback/addFeedback?actionId=" + id,
      btn1: function (index, layero) {
      },
      success: function (data) {
        js.closeLoading(0, true);
      },
      end: function () {

      }
    });
  }
</script>